<?php
class Permission
{
	
	public function isSubCalendarOwner($subCalendarId, $accountId)
	{
		
		$googleAccount = new Google_Accounts();	
		$subCalendar = new Google_Subcalendars();
      	
		$thisSubCalendar = $subCalendar->find($subCalendarId);
      	
    	$thisAccount = $googleAccount->find($thisSubCalendar->gmailAcctId);
    	if ($thisAccount->accountId != $accountId) {
        	return false;
        } else {
        	return true;
        }
		
	}	
	
	public function isAccountOwner($gmailAcctId, $accountId)
	{
		
		$googleAccount = new Google_Accounts();	
		$account = new Google_Accounts();
      	
		$thisAccount = $account->find($gmailAcctId);
      	
    	$thisAccount = $googleAccount->find($thisAccount->gmailAcctId);
    	if ($thisAccount->accountId != $accountId) {
        	return false;
        } else {
        	return true;
        }
		
	}	
	
}
?>